import request from '@/utils/request';

// 1. 基础数据接口
export const getConfigListDict = async (data: any, options?: API.baseOption) =>
  request('/base/list.dict', {
    method: 'POST',
    data,
    ...(options || {}),
  });

export const chatMessages = async (data: any, options?: API.baseOption) =>
  request('/chat-messages', {
    method: 'POST',
    data,
    ...(options || {}),
  });

export const upload = async (data: any, options?: API.baseOption) =>
  request('/files/upload', {
    method: 'POST',
    data,
    requestType: 'form',
    ...(options || {}),
  });

export const generateCode = async (data: any, options?: API.baseOption) =>
  request('/dify/generate/code', {
    method: 'POST',
    data,
    ...(options || {}),
  });

// 1. 基础数据接口
export const getBussinessCode = async (data: any, options?: API.baseOption) =>
  request('/node/getCode', {
    method: 'POST',
    data,
    type: 'node',
    ...(options || {}),
  });

export const generate = async (data: any, options?: API.baseOption) =>
  request('/code/generate', {
    method: 'POST',
    data,
    type: 'code',
    ...(options || {}),
  });

export const task = async (data: any, options?: API.baseOption) =>
  request(`/code/task?id=${data}`, {
    method: 'GET',
    type: 'code',
    ...(options || {}),
  });
